/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pass_client.admin;

import java.awt.BorderLayout;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import org.freixas.jcalendar.DateEvent;
import org.freixas.jcalendar.DateListener;
import org.freixas.jcalendar.JCalendarCombo;

/**
 *
 * @author Administrator
 */
public class DatePicker extends javax.swing.JPanel {
    private JCalendarCombo calendar4;
    /**
     * Creates new form DatePicker
     */
    public DatePicker() {
        initComponents();

        MyDateListener listener = new MyDateListener();

        calendar4 =
                new JCalendarCombo(
                Calendar.getInstance(Locale.KOREA),
                Locale.ENGLISH,
                JCalendarCombo.DISPLAY_DATE | JCalendarCombo.DISPLAY_TIME,
                false);
        calendar4.addDateListener(listener);
        add(calendar4, BorderLayout.CENTER);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setLayout(new java.awt.BorderLayout());
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

    public Date getDate(){
        return calendar4.getDate();
    }
    
    public void setDate(Date date){
        calendar4.setDate(date);
    }
    
    private class MyDateListener implements DateListener {

        public void dateChanged(DateEvent e) {
            Calendar c = e.getSelectedDate();
            if (c != null) {
                System.out.println(c.getTime());
            } else {
                System.out.println("No time selected.");
            }
        }
    }
}
